<?php
require_once('DoodleDAO.php');
require_once('Author.php');
class Doodle
{

	public $id;
	public $name;
	public $desc;
	public $path;
	public $url;
	public $author;
	private $dao;

	public function __construct($id, $name, $desc, $path, $url, $authorId)
	{

		$this->id = $id;
		$this->name = $name;
		$this->description = $desc;
		$this->path = DOODLE_PATH.$path;
		$this->url = DOODLE_HTTP.$url;
		$this->author = Author::findById($authorId);
		$this->dao = new DoodleDAO();

	}

	public static function abstractFromFile()
	{
		$dao = new DoodleDAO();
		return $dao->abstractFromFile();		
	}

	public static function findById($id)
	{
		$dao = new DoodleDAO();
		return $dao->findById($id);
	}	

	public static function findAll()
	{
		
	}	

	public static function findRandom($year=false, $group=false)
	{
		$dao = new DoodleDAO();
		return $dao->findRandom($year, $group);
	}	

}
?>